<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

</body>
<script>
  var nowTime = +new Date();
  var endTime = +new Date('2020-8-20 18:20:0');
  time = (endTime - nowTime) / 1000;

  function countDown(time) {
    var d = parseInt(time / 60 / 60 / 24);
    var h = parseInt(time / 60 / 60 % 24);
    var m = parseInt(time / 60 % 60);
    var s = parseInt(time % 60);
    return d + '天' + h + '时' + m + '分' + s + '秒';
  }

  console.log(countDown(time));

</script>
</html>